import React, {Component} from 'react';
import {Text, TouchableOpacity, View,} from 'react-native';


import {positionfourStyle as styles} from '../../../../../styles';
import Icon from 'react-native-vector-icons/Ionicons';

let Dimensions = require('Dimensions');
let width = Dimensions.get('window').width;          //获取屏幕宽度


export default class Posfour extends Component {
    // 初始化模拟数据
    constructor(props) {            //构造器只执行一次
        super(props);
    };

    render() {
        if (this.props.xzPostion.company === undefined) {
            return (
                <View>
                    <View style={[styles.posfourtop, {width: width * 1}]}>
                        <View>
                            <Text style={styles.posone}>职位介绍</Text>
                            <Text style={styles.postwo}>任职要求：</Text>
                            <Text style={styles.posthree}>
                            </Text>
                        </View>
                    </View>

                    <View style={styles.place}>
                        <Text style={styles.posone1}>工作地点</Text>
                        <TouchableOpacity
                            style={styles.posone2}
                            activeOpacity={1}
                        >
                            <Icon
                                name={'md-pin'}
                                size={18}
                                color={'#3d9ccc'}/>
                            <Text style={styles.posicon5}/>

                            <Icon
                                name={'ios-arrow-forward'}
                                size={20}
                                color={'#949494'} style={styles.posarrow}/>
                        </TouchableOpacity>
                    </View>
                </View>
            )
        } else {
            return (
                <View>
                    <View style={[styles.posfourtop, {width: width * 1}]}>
                        <View>
                            <Text style={styles.posone}>职位介绍</Text>
                            <Text style={styles.postwo}>任职要求：</Text>
                            <Text style={styles.posthree}>
                                {this.props.xzPostion.postionDescription}
                            </Text>
                        </View>
                    </View>

                    <View style={styles.place}>
                        <Text style={styles.posone1}>工作地点</Text>
                        <TouchableOpacity
                            style={styles.posone2}
                            activeOpacity={1}
                            onPress={() => {
                                this.goGet('Map_own', this.props.xzPostion.company.companyX, this.props.xzPostion.company.companyY)
                            }}
                        >
                            <Icon
                                name={'md-pin'}
                                size={18}
                                color={'#3d9ccc'}/>
                            <Text style={styles.posicon5}>{this.props.xzPostion.company.companySpace}</Text>

                            <Icon
                                name={'ios-arrow-forward'}
                                size={20}
                                color={'#949494'} style={styles.posarrow}/>
                        </TouchableOpacity>
                    </View>
                </View>
            )

        }

    }

    goGet(name, x, y) {
        this.props.navigation.navigate(name, {latitude: y, longitude: x});
    }

}